#ifndef THINK_THINK_CONSOLE_OUTPUT_QUESTION_H
#define THINK_THINK_CONSOLE_OUTPUT_QUESTION_H

static char* think_console_output_question =
	"\n"
	"// +----------------------------------------------------------------------\n"
	"// | ThinkPHP [ WE CAN DO IT JUST THINK ]\n"
	"// +----------------------------------------------------------------------\n"
	"// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.\n"
	"// +----------------------------------------------------------------------\n"
	"// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )\n"
	"// +----------------------------------------------------------------------\n"
	"// | Author: yunwuxin <448901948@qq.com>\n"
	"// +----------------------------------------------------------------------\n"
	"\n"
	"namespace think\\console\\output;\n"
	"\n"
	"class Question\n"
	"{\n"
	"\n"
	"    private $question;\n"
	"    private $attempts;\n"
	"    private $hidden         = false;\n"
	"    private $hiddenFallback = true;\n"
	"    private $autocompleterValues;\n"
	"    private $validator;\n"
	"    private $default;\n"
	"    private $normalizer;\n"
	"\n"
	"    /**\n"
	"     * 构造方法\n"
	"     * @param string $question 问题\n"
	"     * @param mixed  $default  默认答案\n"
	"     */\n"
	"    public function __construct($question, $default = null)\n"
	"    {\n"
	"        $this->question = $question;\n"
	"        $this->default  = $default;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取问题\n"
	"     * @return string\n"
	"     */\n"
	"    public function getQuestion()\n"
	"    {\n"
	"        return $this->question;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取默认答案\n"
	"     * @return mixed\n"
	"     */\n"
	"    public function getDefault()\n"
	"    {\n"
	"        return $this->default;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 是否隐藏答案\n"
	"     * @return bool\n"
	"     */\n"
	"    public function isHidden()\n"
	"    {\n"
	"        return $this->hidden;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 隐藏答案\n"
	"     * @param bool $hidden\n"
	"     * @return Question\n"
	"     */\n"
	"    public function setHidden($hidden)\n"
	"    {\n"
	"        if ($this->autocompleterValues) {\n"
	"            throw new \\LogicException(\'A hidden question cannot use the autocompleter.\');\n"
	"        }\n"
	"\n"
	"        $this->hidden = (bool) $hidden;\n"
	"\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 不能被隐藏是否撤销\n"
	"     * @return bool\n"
	"     */\n"
	"    public function isHiddenFallback()\n"
	"    {\n"
	"        return $this->hiddenFallback;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置不能被隐藏的时候的操作\n"
	"     * @param bool $fallback\n"
	"     * @return Question\n"
	"     */\n"
	"    public function setHiddenFallback($fallback)\n"
	"    {\n"
	"        $this->hiddenFallback = (bool) $fallback;\n"
	"\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取自动完成\n"
	"     * @return null|array|\\Traversable\n"
	"     */\n"
	"    public function getAutocompleterValues()\n"
	"    {\n"
	"        return $this->autocompleterValues;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置自动完成的值\n"
	"     * @param null|array|\\Traversable $values\n"
	"     * @return Question\n"
	"     * @throws \\InvalidArgumentException\n"
	"     * @throws \\LogicException\n"
	"     */\n"
	"    public function setAutocompleterValues($values)\n"
	"    {\n"
	"        if (is_array($values) && $this->isAssoc($values)) {\n"
	"            $values = array_merge(array_keys($values), array_values($values));\n"
	"        }\n"
	"\n"
	"        if (null !== $values && !is_array($values)) {\n"
	"            if (!$values instanceof \\Traversable || $values instanceof \\Countable) {\n"
	"                throw new \\InvalidArgumentException(\'Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.\');\n"
	"            }\n"
	"        }\n"
	"\n"
	"        if ($this->hidden) {\n"
	"            throw new \\LogicException(\'A hidden question cannot use the autocompleter.\');\n"
	"        }\n"
	"\n"
	"        $this->autocompleterValues = $values;\n"
	"\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置答案的验证器\n"
	"     * @param null|callable $validator\n"
	"     * @return Question The current instance\n"
	"     */\n"
	"    public function setValidator($validator)\n"
	"    {\n"
	"        $this->validator = $validator;\n"
	"\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取验证器\n"
	"     * @return null|callable\n"
	"     */\n"
	"    public function getValidator()\n"
	"    {\n"
	"        return $this->validator;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置最大重试次数\n"
	"     * @param null|int $attempts\n"
	"     * @return Question\n"
	"     * @throws \\InvalidArgumentException\n"
	"     */\n"
	"    public function setMaxAttempts($attempts)\n"
	"    {\n"
	"        if (null !== $attempts && $attempts < 1) {\n"
	"            throw new \\InvalidArgumentException(\'Maximum number of attempts must be a positive value.\');\n"
	"        }\n"
	"\n"
	"        $this->attempts = $attempts;\n"
	"\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取最大重试次数\n"
	"     * @return null|int\n"
	"     */\n"
	"    public function getMaxAttempts()\n"
	"    {\n"
	"        return $this->attempts;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 设置响应的回调\n"
	"     * @param string|\\Closure $normalizer\n"
	"     * @return Question\n"
	"     */\n"
	"    public function setNormalizer($normalizer)\n"
	"    {\n"
	"        $this->normalizer = $normalizer;\n"
	"\n"
	"        return $this;\n"
	"    }\n"
	"\n"
	"    /**\n"
	"     * 获取响应回调\n"
	"     * The normalizer can ba a callable (a string), a closure or a class implementing __invoke.\n"
	"     * @return string|\\Closure\n"
	"     */\n"
	"    public function getNormalizer()\n"
	"    {\n"
	"        return $this->normalizer;\n"
	"    }\n"
	"\n"
	"    protected function isAssoc($array)\n"
	"    {\n"
	"        return (bool) count(array_filter(array_keys($array), \'is_string\'));\n"
	"    }\n"
	"}\n"
	"\n"
;
#endif